package io.datajek.springbasics.movierecommendersystem.lesson7;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

//推荐电影方法的逻辑
//将过滤器的类型从基于内容改为协作式
//CollaborativeFilter-协同式过滤
@Component
public class RecommenderImplementation {

    @Autowired
    @Qualifier("CBF")
    private Filter Filter;

    @Autowired
    public RecommenderImplementation(@Qualifier("CBF") Filter filter) {
        this.Filter = filter;
        System.out.println("Constructor invoked...");
    }

    public String[] recommendMovies (String movie) {
        System.out.println("正在使用的过滤器名称:" + Filter + "\n");
        //使用ContentBasedFilter来寻找类似的电影
//        CollaborativeFilter filter = new CollaborativeFilter();
        //上面的语句的filter不需要重新定义了
        //此处的输入参数暂时无用
        String[] results = Filter.getRecommendations("Finding Dory");
        //返回结果
        return results;
    }
}
